% WireGrid for Windows Manual
% Written by      :  IP Theron
% Version         :  2.10
% Last Edited by :  FJC Meyer 
% Last Edit Date  :  6 May 1996
% 
%
\documentstyle[11pt,twoside,manual]{article}
% \special{landscape}
\addtolength{\hoffset}{-8 mm}
\addtolength{\voffset}{6 mm}
\parskip 0.25cm
\parindent 0.0cm
\nofiles


\begin{document}
\pagestyle{headings}

% ***********************************************
% Front page 
% ***********************************************
\thispagestyle{empty}
\vspace*{-2.4cm}
\fbox{
\begin{minipage}{13.5cm} 

\vspace*{1cm}

\hspace*{0.5cm} \picbox{head3.bmp}{120}{30}  

\vspace*{3.75cm}

\hspace*{4.25cm}  \picbox{icon.pcx}{55}{55}  

\vspace*{4.00cm}

\hspace*{0.75cm} {\Large\bf User's Guide}  

\vspace*{-2.25cm}

\hspace*{9.0cm} \picbox{logo_r3.bmp}{45}{25} 
\end{minipage}
}
\clearpage
\thispagestyle{empty}
Empty Page

\newpage
% ***********************************************
% Title Page  
% ***********************************************
\thispagestyle{empty}
\vspace*{0.1cm}
\centerline{\Huge\bf WireGrid for Windows \vspace{2 mm}}
\centerline{\large\bf User's Guide for version 2 \vspace{10 mm}}
\centerline{\Large\bf A NEC Pre-processor \vspace{10 mm}}
\vspace*{9cm}
\picbox{logo.pcx}{30}{15} \\
{\large\bf EM Software \& Systems} 

\newpage
% ***********************************************
% Info Page   
% ***********************************************
\thispagestyle{empty}
\small
WireGrid for Windows - A NEC Pre-processor \\ 
User's Guide for Version 2 \\
Authors: IP Theron and FJC Meyer \\
Date: 22 April 1996 \\[5mm] 

WireGrid for Windows was developed by: \\
IP Theron \\
under contract for: \\
{\bf EM Software \& Systems} \\
Innovation Centre II, Suite 2C \\
Meson street, Technopark \\
Stellenbosch, 7600 \\
South Africa \\
Tel: +27-21-880-1880 \\
Fax: +27-21-880-1880/1727 \\
Email: fjcmeyer@emss.co.za \\
Email: agsmith@emss.co.za \\ [1 mm]
In collaboration with \\[1 mm]
{\bf Department of Electrical and Electronic Engineering} \\
University of Stellenbosch \\
Stellenbosch, 7600 \\
South Africa \\
Email: davidson@firga.sun.ac.za 

Some of the source code of WireGrid for Windows was extracted from the source code of WireGrid for MS-DOS developed by: \\
CF du Toit \\
Department of Electrical and Electronic Engineering \\
University of Stellenbosch \\
South Africa \\
\normalsize

% ***********************************************
% TOC page 
% ***********************************************
\clearpage
\pagenumbering{roman}
\setcounter{page}{1}
\parskip 0.2cm
\tableofcontents

\clearpage
\thispagestyle{empty}
Empty Page

\clearpage
\parskip 0.25cm
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Installation Instructions}

\fbox{
\parbox[t]{12.5cm}{\bf PLEASE READ THE FOLLOWING INSTALLATION
INSTRUCTIONS CAREFULLY~!!} }

\subsection{Hardware and software requirements}

This program requires {\em Microsoft Windows}. (It was developed under 
{\em Windows~3.11\/} and has also been used under {\em Windows~95\/}
and {\em Windows~NT}.) The code will run on a 486 machine with 4~Meg
RAM, but more memory is recommended. Also, for large models, the
graphic utilities might become slow. In order to fully utilise the graphic
capabilities both a colour screen and mouse are recommended.

\subsection{Creating a WireGrid icon}
Create a directory WIREGRID on the ``C'' drive (or drive of your
choice). Copy all files on the 3-1/2 inch disk supplied with this
manual to the WIREGRID directory. Create a new program group and
program item for WireGrid. (See the Windows Users Guide for assistance
in creating the new program group, program item, icon, etc.) When
creating a new program item, \verb+C:\WIREGRID\winwire.exe+ should be  entered in the ``Command Line'' box, and \verb+C:\WIREGRID+ in the Working
Directory box. WireGrid for Windows can now be executed by
double-clicking on the WireGrid icon.   

\subsection{Entering the correct password}
When WireGrid is run on your computer (PC) for the first time, an introductory screen appears, informing you that ``Your installation is unregistered''. A reference code is supplied on the same introductory screen. (The reference code can also be found in the file ``setpass.wg''. Note that the reference code, and ``setpass.wg'' file, are created the first time you run WireGrid on your PC. The file is stored in the same directory as the WireGrid executable ``winwire.exe''.) 

{\bf TO REGISTER}, please fax or email your: \\
Reference Code: \\
Name: \\
Company/Institution: \\
Fax No.: \\
Tel No.: \\
E-mail: 

to

{\bf EM Software \& Systems (EMSS)} \\
Fax: +27-21-880-1880 \\
Email: fjcmeyer@emss.co.za \\
Email: agsmith@emss.co.za \\


EMSS will then respond by supplying you with a password. This password
should then be typed into the ``Enter new password'' box on the introductory
screen. NOTE: The introductory screen will appear (with the reference
code and ``Enter new password'' box) each time WireGrid is executed
{\em without} the appropriate password.

After the correct password has been entered, WireGrid should run
without any problems on the PC it has been installed on. 

{\bf Please note that the password supplied to you by EMSS is associated with your
specific PC. If you install WireGrid on a different PC, a new password would be required.  If major systems changes are made to your PC, a new password could also be required. If a new password is  required, please contact EMSS.}  

\subsection{Using WireGrid as a Demo}
The Introductory screen also has a Demo button. Choose this button to use the demo version of WireGrid {\em without} the appropriate password. The only limitation of the demo version of WireGrid is that a maximum of 15~elements can be saved. 

Please feel free to distribute your copy of WireGrid to anybody who is interested. They can use the Demo version to investigate and evaluate WireGrid and would have to register before receiving the password for the full version.


\section{About WireGrid}
{\em WireGrid for Windows\/} is a pre-processor for the thin wire moment 
method code called {\em NEC}\@. Although {\em NEC\/} allows the use of
surface patches it uses the magnetic field integral equation --- thus
requiring closed surface structures when using surface patches. It is
often required to model an open structure, for example the body of a
car with non-conducting windows. Such surfaces are usually modelled by
constructing a wire mesh on the conducting surfaces.

This code automates the discretisation of these conducting surfaces in
terms of wire meshes for analysis in {\em NEC\/} and allows visual
feedback of the model structure as well as the positions of sources,
networks and field points. It also does some checking regarding
duplicate wires and closely spaced nodes --- not making contact.


\section{Structure of the Model}
\label{sec:StructureSection}
A model is constructed by breaking conducting surfaces into flat polygonal 
elements. These --- called the major elements --- are entered by
specifying the co-ordinates of the nodes or corners of the polygon. The
co-ordinates of the nodes may be in any order. However, {\em elements
with corner angles larger than 180$^o$ are not allowed.} The elements
do not need to be perfectly flat, but the discretisation procedure may
fail if some of the nodes are too far from the plane of the element.
Straight wires can be entered as elements with only two nodes.
(Multiple node elements can have more than two nodes lying in a line,
provided not all the nodes lie in line.)

The surface is discretised according to a specified ``maximum segment 
length''. By changing only this parameter, the density of the mesh can be 
changed throughout the structure. The discretisation procedure first
divides the element sides into segments of equal length --- while 
also ensuring that the maximum segment length is not exceeded. Next
primary lines are spanned between sub-nodes on opposite sides of the
element and finally the secondary wires are spanned orthogonal to the
primary lines. The primary lines are divided into segments of equal
length, with the number of segments determined by the number of
secondary lines crossing that particular line. The secondary lines link
the sub-nodes on the primary lines to each other and the nodes on the
element sides --- thus they are not straight and their segments may
also differ in length. Each secondary line segment is written to NEC in
a separate \verb+GW+ card. If the length of a segment on a secondary
line is less than 30\% of the specified ``maximum segment length'' it
is not added. (This usually occurs only for the first or last segment
on a primary line in the vicinity of a sharp corner where the short
segment is likely to have its centre inside one of the two wires it is
connecting.)

If the structure is too big to be discretised within the limits of the
code (a maximum of 50 for either primary or secondary lines) that
element will not be discretised and a warning will be given. Apart from
the warning (which will be repeated when the {\em NEC\/} input file is
created) the program will continue as usual. It is possible to ignore
the warning and continue with both the model creation and writing the
{\em NEC\/} file. This will allow the user to determine if the problem
occurs on only a few segments which can then be split up, or if the
maximum segment length must be increased (lengthened).

The maximum number of segments allowed on any wire or major element
side is 255. Thus any element side or wire longer than 255 times the
specified ``maximum segment length'' will have segments of unacceptable
length --- {\em the user will not be warned about this}, but an option
in the Verify menu allows the user to check the complete model for such
elements. The user is advised to divide these elements into a number of
smaller elements. (This limit is likely to affect only two-node wires
as the limit of 50 lines in the discretising process will, in most
cases, be the first to be exceeded.)

\section{The Main Interface Window}
\label{sec:MainWindowSection}
The main interface window, shown in Figure~\ref{MainInterface}, displays a graph of the model and provides a brief visualisation of the main features of the model.  The  components present in the main interface windows can be summarised as follows (see Figure~\ref{MainInterface}): 
\begin{itemize}
\item Main Menu: Drop down type menu for all WireGrid commands, tools and features.
\item Main Tool Bar: Button type bar for frequently used WireGrid tools.
\item Symmetry Bar: Button type bar for utilising model symmetry.
\item Radius Box: Wire radius criteria options.
\item Graph Window: Physical screen area available for the graph, which is the complete bitmap of the model.
\item Graph Tool Bar: Button type bar for frequently used graph related features.
\item Information Bar: Contains important model information.
\end{itemize}

All the command, features and tools of WireGrid can be accessed via the ``Main Menu'' structure (which will be discussed in Section~\ref{sec:MenuSection}). The tool bars and boxes, present in the main interface window,  assist the user in using WireGrid as efficiently as possible. These ``items'' will be discussed in more detail in the subsequent sections.
\begin{figure}[t]
   \centerline{\picbox{full2.gif}{125}{90}}
   \caption{The main interface window}
   \label{MainInterface}
\end{figure}

\subsection{Main Tool Bar}
The Main Tool Bar, with captions, is shown in Figure~\ref{MainToolBar}. These 
functions are all available from the Main Menu and will be discussed in more detail in Section~\ref{sec:MenuSection}.
\begin{figure}[ht]
   \centerline{\picbox{mainbar.pcx}{125}{50}}
   \caption{The main tool bar}
   \label{MainToolBar}
\end{figure}

\subsection{The Symmetry Bar}
\label{sec:SymmetryBar}
The Symmetry Bar  (below the Main Tool Bar) allows the user to remove
wires from certain planes and regions. A depressed button indicates
that the wires associated with the specified region (plane) have been removed (note that the major elements are {\bf NOT} removed --- the removed wires can thus be ``reintroduced'' if required). In order to specify a conducting surface lying orthogonal to a plane of symmetry or to the ground plane, the user must specify an element with at least one side lying completely in that plane. The symmetry bar allows the user to
remove that wire without removing the element or having to manually
construct the mesh of wires.

\subsection{The Radius Box}
\label{sec:RadiusBox}
To the right of the Symmetry Bar is the Radius Box. This allows the
user to specify how the radii of the mesh segments are calculated. By
default the radii are calculated from the maximum segment length
divided by $2\pi$ --- the rule of equal surface area. (This will ensure
that the wiregrid under consideration models a conducting surface area
with a high degree of accuracy.) The user is allowed a choice between:
\begin{enumerate}
\item Using the {\bf ``segment length''} (the default) as the criterium for 
calculating the radii of the segments. If this option is chosen, the wire radii in the mesh will vary according to the length of each specific segment (that is radius = length of segment/$2 \pi$). The radius-to-segment-length-ratio will thus be the same throughout the mesh, and unacceptable values for this ratio will be avoided. However, the 
rule of equal surface area will not necessarily be satisfied. 
\item Using the {\bf ``nominal length''} as the criterium for calculating the radii of the segments. If this option is chosen, all wire radii in the mesh will be the same (and will satisfy the rule of equal surface area --- radius = maximum segment length/$2 \pi$). 
This could however lead to a situation where unacceptably radius-to-segment-length-ratios are encountered.  
\item Using a {\bf ``fixed''} radius value (radius = fixed radius
specified by user) throughout the model --- except for the
wires (two-noded major elements) for which distinct radius values have 
been specified. This option can be useful when exceptionally long thin
``major elements'' with short sides --- much shorter than the maximum
segment length --- have been specified. Choosing a (relatively thin)
fixed radius value throughout the mesh will then avoid overlapping
wires for these ``special'' elongated major elements. However, the rule
of equal surface area will almost certainly not be satisfied if this
option is chosen.  
\end{enumerate}



\subsection{The Graph Window}
The Graph Window is the physical screen area available for the graph, which is the complete bitmap of the model. The graphical display enables the user to view models and their discretisation while entering and editing the major elements. The model can be rotated by specifying the viewing angles as discussed in Section~\ref{sec:GraphBarViewBoxSection}. Additional information can be shown in 
the graph as discussed in Section~\ref{sec:ViewMenuSection}. The graph can be larger 
than the graph window in which case it must be scrolled inside the graph 
window in order to view another part thereof.

\subsubsection{Mouse button functions}
When the {\bf right mouse button} is clicked somewhere inside the Graph Window the 
node closest to this point (in terms of the distance on screen) is highlighted 
and its co-ordinates shown (in red) at the bottom in the Information Bar (three co-ordinate boxes). All elements containing this node are also highlighted allowing the user to determine whether all elements at the node are, in fact, connected. Clicking 
and dragging the {\bf left mouse button} draws the ``Selection box'' on the screen. 
This box is used in zooming and selection of elements.

\subsection{The Graph Tool Bar}
\label{sec:GraphBarSection}
The Graph Tool Bar is shown with captions in Figure~\ref{GraphToolBar}. 
Most of these functions are also available through the {\bf View} item in the Main 
Menu (discussed in Section~\ref{sec:ViewMenuSection}). The functions using the 
``Selection box'' can, however,  only be addressed using the Graph Tool Bar. These will now be discussed.

\begin{figure}[ht]
   \centerline{\picbox{graphbar.pcx}{100}{110}}
   \caption{The graph tool bar}
   \label{GraphToolBar}
\end{figure}

\subsubsection{Zoom to window}
This zooms the graph to the space inside the ``Selection box''. It fits either 
the height or the width of the box to the space inside the graph window, but 
does not re-scale the window. Thus some extra space will be added either at the 
sides or the top and bottom. This function differs from the {\bf Zoom in} and 
{\bf Zoom out} functions discussed in Section~\ref{sec:ViewMenuSection} in that it 
cuts out the necessary section, rather than enlarging the complete graph.

\subsubsection{Highlight window, Un-highlight window}
\label{sec:GraphBarHighlightSection}
These two buttons add (or remove) all elements inside the ``Selection  
box'' to the list of selected elements. Determination whether the element lies 
inside the box is done after it is projected onto the screen --- hence, if 
necessary, certain elements can be excluded by rotating the graph to a 
different viewpoint.

\subsubsection{Viewpoint boxes}
\label{sec:GraphBarViewBoxSection}
These three boxes determine the position of the viewer looking directly 
towards the geometrical centre of the model. The ``View distance'' only affects 
the appearance of the graph if the model is viewed with perspective. It gives 
the radial distance from the viewer to the centre of the model, while the 
angles follow the spherical co-ordinates as defined in Figure~\ref{assefig}. 
The values in these boxes can be changed by clicking on the spin buttons to 
the side of each box. The increments (when the spin button is clicked) of 
$\theta$ and $\phi$ are fixed at $5^o$ and that of $r$ are determined from the 
size of the model with the $r$-value being reset each time the model is drawn 
to full scale. Values for $\theta$, $\phi$ and $r$ can also be typed in manually into the Viewpoint boxes (any integer value is allowed). 

{\bf Note}:--- Each time a key is pressed, new viewpoint information is calculated and evaluated, and the displayed graph is updated. The values for the angles are tested and reset if they lie outside the allowable limits for  $\theta$,  $\phi$ and $r$. This means that it will usually be necessary to delete characters in the Viewpoint boxes, before trying to enter new ones.

\vspace*{0.5cm}

\begin{figure}[ht]
   \centerline{\picbox{assefig.pcx}{65}{70}}
   \caption{The definition of the angles to the viewpoint, $P$.}
   \label{assefig}
\end{figure}
\clearpage

\subsection{Information Bar}
Along the bottom of the Graph Window several useful bits of information are 
presented. These include:
\begin{itemize}
\item model filename
\item number of major elements (a maximum of 999)
\item specified ``maximum segment length'' for the model
\item specified ``axis length'' (providing some idea of the scale of the model)
\item zoom percentage
\item co-ordinate boxes
\end{itemize}

The information in the Information Bar is updated automatically and serves the purpose of supplying the user with important and useful information while editing/creating a model.

\section{The Main Menu Structure}
\label{sec:MenuSection}
\subsection{File menu}
The file menu handles the interface with the operating system and the loading 
and saving of files, saving and printing graphs and creating the {\em NEC\/} 
input file.

\subsubsection{New Model}
This clears the present model from the workspace area in order to allow the user to create a new model. 

\subsubsection{Load Model, Save Model, Save Model As}
These procedures handle the loading and saving of models. ({\em WireGrid for 
Windows\/}  will load old {\em WireGrid 4.0 for DOS} models, but the segment 
length will be corrupted.) {\bf Save Model As} only renames the model --- to 
save it to a different format the {\bf Save As Text} command must be used.

The complete model data, including the state of the symmetry buttons, is saved 
in a \verb+*.he+ file. When a model is loaded into a workspace already containing a model, the user can decide whether:
\begin{enumerate}
\item the new model be loaded into the workspace and the old model be cleared from the workspace.
\item the new model be added to the current model.
\end{enumerate}

If the latter option is chosen (``add new model to current model''), the following points must be kept in mind:
\begin{itemize}
\item  All wire removals (see Symmetry Bar options) of the newly loaded model will be ignored;
\item If a model file is loaded into an {\em empty} workspace, WireGrid accepts that name and will save any subsequent changes to that filename. However, if a model file(s) is loaded and added to a model currently in the workspace, the first (or base) filename will be associated with the newly created (or combined) model. WireGrid will thus save the combined model information to the original base filename. {\bf NOTE:} If the model information in the base filename needs to be kept intact, care must be taken to save the combined model information to a different filename by using ``Save Model As'' option; 

\item The Control Card information of the newly loaded model is added to the 
list of Control Cards of the current model. The major-element numbers associated with the Control Cards of the newly loaded model are, however, not updated. This updating is necessary to account for the fact that the  major-element {\em numbers} associated with the Control Cards of the newly loaded model will change in the combined model. It is thus important to remember to edit the Control Cards in the combined model accordingly.
\end{itemize}

Also note that:
\begin{itemize}
\item If the first major element of a model is typed in from the edit window or loaded from a text or {\em NEC\/} file, the model will not have an assigned filename until specifically entered by the user --- even if previously saved models are added to the workspace.
\item Models can be loaded by running {\em WireGrid for Windows\/} with the 
filename as a command line parameter. For example, \verb+winwire.exe model.he+ 
will load the indicated model.
\end{itemize}

\subsubsection{Save as Text, Load Text Elements}
These commands allow interfacing with other codes using elements rather than 
wires. The basic format for loading is the same as when a model is saved, 
but the fields merely have to be separated with spaces and need not be 
perfectly positioned as they are in the output file. Zeros, however, must be 
shown as such --- blanks will result in loading errors. The beginning of each 
element is indicated by a line containing the number of nodes for that 
element. The node data (one line per node) immediately follows this line. Each 
node is specified by its $x$, $y$ and $z$ co-ordinates written on a single 
line separated with spaces only, as shown in 
Figure~\ref{TeksDataFiguur}.
\begin{figure}[ht]
{\small\begin{verbatim}
                4
                    0.00000     1.00000     0.00000
                    0.00000     1.00000     1.00000
                    0.00000     0.00000     1.00000
                    0.00000     0.00000     0.00000
                4
                    0.00000     0.00000     0.00000
                    0.00000     0.00000     1.00000
                    1.50000     0.00000     1.00000
                    0.50000     0.00000     0.00000
                2
                    1.00000     1.00000     0.00000
                    1.00000     1.00000     1.00000
                3
                    1.00000     1.00000     0.00000
                    0.00000     1.00000     1.00000
                    0.00000     1.00000     0.00000
\end{verbatim}}
\caption{An example of a text file for interfacing with {\bf WireGrid for Windows.}}
\label{TeksDataFiguur}
\end{figure}


\subsubsection{Load NEC Wires}
This function loads wires from previously saved {\em NEC\/} files. Note that, 
as wires are loaded rather than elements, the discretisation procedure will 
not refine meshes loaded in this fashion. The number of segments on each wire 
is loaded from the file, but this will change if the segment length is 
changed. The code will only react on \verb+GW+ (including a \verb+GC+ card if 
the wire is tapered), \verb+GX+ and \verb+GS+ cards, but will warn the user if 
it encounters other control cards in the geometry section of the {\em NEC\/} 
file.


\subsubsection{Create NEC File}
The user is asked for a filename before the {\bf Create NEC File} window is 
opened. This window allows the user to enter two comment lines. (The code will 
also, automatically, write comment lines indicating the \verb+*.he+ file 
containing the model, the maximum segment length allowed, the status of the 
symmetry wire removal, and whether odd wire discretisation was enforced).

An option box allows the user to determine whether field data for the wires 
must be separated with spaces or commas. (If spaces are selected the wire cards 
will be formatted in the 10-wide fields, making it easier to read.) The 
co-ordinates are written to five decimal places, thus it is advisable to use 
commas for models containing large co-ordinates. The field ``-100.00000'', for 
example, is 10 characters wide and will touch the next field which may cause 
problems for some versions of {\em NEC}. 

The next box allows a choice of metre 
or millimetre for the co-ordinates used in the model. (Thus small models may 
be entered with the co-ordinates in millimetre. It merely includes a scale card 
to scale the model down by a factor of $10^{-3}$ --- this can also be done by 
adding such a card directly to the list of control cards.)

The last option box allows previous files to be appended. Thus the user can 
use the \verb+NX+ card instead of the \verb+EN+ card and have multiple 
structures (each with a different geometry) in the same input file. If 
``Append old file'' is selected without a file of the specified name existing 
such a file will be created, while a warning will be given if ``Create new 
file'' is selected using the filename of an already existing file. \\
{\bf Note:} None of the above mentioned options is saved (or associated with the specific model under consideration). Thus, they have to be specified each time the code is used. 


\subsubsection{Print Graph, Save Graph}
These functions copy the bitmap of the current model to either the 
associated printer or a bitmap file. The user is asked to specify a height and 
width for the graph. When either value is set to zero, that value will be 
calculated in such a way that the ratio in the current graph is maintained. Printing the bitmap file to a 300dpi device will result in a graph with the specified dimensions. 

The bitmap can be created in full colour or in black and white --- the last option is recommended for printing to black and white devices. If the ``Entire model'' option 
is selected, the full model, stripped from the white space surrounding it, will be printed. Otherwise the current window, including all white space, is printed. Printing 
is done by scaling the current graph to the required size (rather than 
regenerating the plot to the printer canvas). Thus the resolution will be the same 
as on the screen. For plots not showing actual wire radii, the line width is 
one pixel --- independent of the size of the graph. Thus, the larger the graph, 
the narrower the lines will be in relation to it, and the narrower they will 
appear in the final plot. The wire thickness can therefore be ``controlled'' 
by zooming in or out.


\subsection{Edit menu}
The edit menu forms the core of the program and allows the entering and 
editing of models.

\subsubsection{Specify Segment Length}
This allows the user to specify the ``maximum segment length'' used to 
determine the fineness of the WireGrid mesh.

\subsubsection{Add Major Element, Edit Major Element}
Either of these opens the edit window in which the user can enter or change the 
parameters of a major element. The first box allows the element number to be 
selected. (For {\bf Add Major Element} this box is disabled.) Each time the 
user changes the element number the corresponding element is highlighted in the 
Graph Window, giving visual feedback of the position of the element. The next 
box specifies the number of nodes (between 2 and 10) followed by a grid on 
which the user can enter the co-ordinates. If the element is a two-node wire, 
a wire radius box appears. The user can determine if the radius of the wire 
must be calculated in the same way as for the mesh elements (``Radius related 
to length''), or if it must be set to a fixed value (``Specify radius value''). If the latter option is chosen, the wire radius at each of the two nodes must be specified by the user.

The co-ordinate data of the major-elements must be entered by hand. Clicking with the  left-button of the mouse on a cell in the co-ordinate-grid will highlight that cell. Values typed in at this point will overwrite previous values. Clicking the left-button of the mouse a further two times (or pressing $<$F2$>$) will allow editing the 
contents of that value without overwriting it. The co-ordinates may be entered in any order and the element does not have to be perfectly flat, but {\em elements with corner angles of larger that 180$^o$ are not  allowed.}

The user can also select the co-ordinates of a particular (existing) node in the model by 
clicking the {\bf Get} button at the bottom of this window and then clicking 
on a node of the model in the Find Node Window. The first co-ordinate shown in the Find Node Window will be  the co-ordinates of the current co-ordinate-grid row. This node is then also displayed in the Find Node Window and provides a crude way to find the actual position of any newly created node on the model graph.

Each time this  window is activated a default element is chosen. This default element is the last element in the list of highlighted elements, or the last element of the model ---
if no elements are selected.  For the {\bf Edit Major Element} the default element will be the selected  element for editing purposes. For the {\bf Add Major Element} operation the 
co-ordinates of the default element serve as the starting co-ordinates for creating a new major element. Note that it is also possible to exchange the order of nodes in the co-ordinate-grid by ``clicking and dragging'' with the mouse on the row number.  

After an element has been added or edited it will remain highlighted in the 
Graph Window. Automatic checking algorithms ensure that an element does not have a duplicate  node and that all the nodes of an element do not lie in a straight line (except for a 2-node element). No checks are done for ``duplicate elements'' at this stage in the program. (Duplicate elements can be checked for under the {\bf Verify} menu --- see Section~\ref{sec:VerifyMenu}.) 

\subsubsection{Copy Major Element(s)}
\label{sec:CopyMajorElement}
This command opens a window which combines the three commands:
\begin{enumerate}
\item Translation
\item Mirror 
\item Rotation
\end{enumerate}
A list of elements is selected by typing the numbers separated by commas, with ranges specified by a minus sign (for example ``1,4,7-12,17,16-20''). Duplicate elements (like 17 in the above example) will be discarded automatically. Any number of elements can be selected and will be highlighted in the Graph Window. The create mode box determines whether additional elements are added (``Copy'') or if existing elements are changed (``Move'') to define the new position(s).

{\bf Translation} is specified by entering the translation vector. \\
{\bf Mirror} allows mirroring in any one of the three principle planes ($x=0$, 
$y=0$ or $z=0$) or a user defined plane lying orthogonal to the end of a 
vector from the origin to the specified point. \\
{\bf Rotation} is specified by giving the start and end points of a vector around which the elements must be rotated. Rotation is specified in degrees in a right handed sense.  The order of the start and end points is thus important. \\
Pointing to the labels of any of these functions will show a brief hint as to how the transformation is specified.


\subsubsection{Delete Major Element(s)}
This window allows the user to delete an element or a list of elements 
(specified in the same way as discussed above in relation to selecting a list 
of elements to copy). A button ({\bf Show element(s)}) on the window allows the 
user to ``see'' (or highlight) the elements before deleting them.

\subsubsection{Edit Major Node}
Choosing this function allows a single node to be shifted --- all elements 
containing that node will be affected. If a node was selected (by clicking the 
right mouse button) before selecting {\bf Edit Node} the co-ordinates of that 
node will appear as the default co-ordinates of the node that must be changed. An option in this window allows the user to choose between: \\
1)  displacement of the node to a specified co-ordinate value; \\
2)  translation of a node by a specified value relative to its current position.\\

{\bf Note:} If changing the node will cause a duplicate node in a specific element, that 
element will not be changed.


\subsubsection{Scale entire model}
This scales the entire model by the factor entered by the user. Note that all co-ordinate related information of the model is changed according to the scale factor. {\bf Note} that this is different to using a {\em NEC\/} scaling card.

\subsubsection{Odd wire discretisation}
Choosing this option forces all element sides to have an odd number of 
segments. The number is rounded towards the larger odd integer --- the 
``maximum segment length'' criteria are strictly adhered to. This is extremely 
useful when modelling structures like Yagi or Log-Periodic antennas where the 
wires are connected with a transmission line at their centres --- requiring an 
odd number of segments. 

{\bf Note:} This option influences the density of the mesh and must thus be used with caution.

\subsection{Controls menu}
This menu simplifies the use of Control Cards with {\em NEC\/}. However, by no means does it replace the necessary knowledge of the {\em NEC\/} structure required by the user. 
The ``Command list'' shows the complete list as it will be passed to the {\em NEC\/} file. This enables the experienced user to see exactly what he is specifying. An example of this window is shown in Figure~\ref{ControlCardEditor}. From this figure it is clear that the user can, for example, check the positions of frequency loops and radiation pattern cards and consequently determine which patterns will appear inside the frequency loop. 

In order to simplify visualisation, the 10-digit spacing format used in {\em NEC2\/} is preferred. The control cards are saved to a separate ASCII file with a \verb+*.wgb+ 
extension.
\begin{figure}[p]
   \centerline{\picbox{control.pcx}{100}{148}}
   \caption{The Control Card Editor}
   \label{ControlCardEditor}
\end{figure}

Cards specifying tag and segment numbers (such as voltage sources, 
transmission lines, two-port networks and coupling requests) can only be 
applied to straight wire (two node) elements.  If a segment on a major element with more than 2-nodes needs to be used with these Control Cards,  a two-node wire can be placed on the appropriate side of the major element. The Control Cards can then be applied to this two-node element.  (In such a case the mesh generation procedure will ensure that no duplication of segments will occur. This is done by suppressing the segments on the related side of major element containing more than two-nodes.)  

When a model is added to an existing one the Control Cards are appended. \\
{\bf Note}, however, that when one model is added to an existing one, the major element 
{\em numbers} in the combined model will be different from those of the original model. 
The corresponding Control Cards are not modified, and Cards where tag and segment 
numbers are specified might therefore be wrong. This also applies to the segment number on a given wire if the maximum segment length is changed such that the wire is divided into a different number of segments. (This problem can be overcome by adding a very short wire element for the excitation. Provided the maximum segment length remains longer than this element, it will always contain only one segment. Be careful, however, not to violate the {\em NEC\/} criterium for the ratio of adjacent segment lengths --- this can especially be
critical near the feed of a structure.)  It is recommended that all Control Cards be checked carefully, immediately before the {\em NEC\/} file is created. 

Certain functions in the Control Card ``editor'' simplify the addition of certain cards, while others enable the user to manipulate the list or visualise what a certain card 
entitles. The different functions of the buttons in the Control Card editor will now be considered.

\subsubsection{Geometry end}
This function opens a window of options. The user can specify symmetry 
options causing \verb+GM+ and \verb+DR+ cards to be written to the list. This 
will automatically set the required wire removal conditions on the ``Symmetry 
Bar''.  {\bf Note:} The user is allowed to change this ``Symmetry Bar'' setting(s) after the Control Card editing has been completed. This should not be done unless the appropriate Control Card symmetry options have been changed accordingly.

The user can also determine the existence and type of ground plane, its 
parameters (including a ground screen if the reflection coefficient 
approximation is chosen), whether the wires are connected to the ground plane 
(in other words interpolated to their images), and specify the error testing 
capabilities build into {\em NEC4}.\footnote{It was decided to bias 
towards {\em NEC4} in cases of differences between {\em NEC4} and {\em NEC2}.} This 
will result in a \verb+GE+ and, if required, a \verb+GD+ card being added to 
the list. ({\bf Note:} NEC2 users should use the default in the ``Error testing'' box. Other ``Error testing'' options can cause NEC2 to crash.)

\subsubsection{Networks}
This allows specification of transmission line cards and two port networks. 
The window contains boxes for the element number and segment number of the 
start and stop segment in the case of a transmission line and the segments 
comprising ports 1 and 2 segments for a two-port network. Each time the 
element number is changed, the segment box is set to the centre segment. (For 
wires with an even number of segments the higher of the two centre segments is 
chosen.) The segments under consideration will automatically be shown in the 
Graph Window. In both cases the user must type in the remaining parameters.

The transmission line section allows a choice between using: \\
1) a single line between the two specified nodes; \\
2) multiple lines between the two specified nodes; \\
If the multiple line option is chosen (this option is particularly useful when modelling Yagi or  log-periodic antennas), transmission lines will be added between all elements from the start element to the end element choosing the centre segment wire.
(The three \verb+TL+ cards in Figure~\ref{ControlCardEditor} were created with 
multiple lines between elements 10 and 13.) The user must ensure that the end 
element is larger than the start element and that all the elements affected 
are in fact two-node (wire) elements. 

\subsubsection{Frequency}
The user can specify the start and stop frequencies as well as the 
number of frequency points (including both ends). The code will then 
calculate the increment or multiplication factor (depending on the option 
selected by the user) and add the correct card to the list.

\subsubsection{Source}
This allows voltage and current sources to be added. For voltage sources the 
user specifies the element and segment numbers and the value of the voltage 
source. The segment will be shown (highlighted) in the Graph Window each time the element or segment number is changed. The segment number is set to the centre segment each time the element number is changed.

For a current source the user must type in the position of the source and the 
angles (``Alpha'' and ``Beta'') defining its orientation. The definition of 
the angles is shown if the cursor is pointed at either label. In this case the 
user must click on the {\bf Show} to visualise the source. The co-ordinate position of the current source is shown by a {\em dot} in the Graph Window and the orientation is indicated by a {\em short line} in the positive direction of the source.

\subsubsection{Patterns}
This window allows the user to specify radiation patterns or near fields while 
visualising the positions (observation points) where the fields will be calculated. In both cases the user must click on the {\bf Show} button to visualise the observations points in the Graph Window.

For near fields the user can select electric or magnetic fields, as well as 
the co-ordinate system (rectangular, spherical, or points along a line whose 
end-points are defined in a Cartesian co-ordinate system). The co-ordinate 
values and the number of points (again including both ends) must be typed in.

In the case of radiation patterns either spherical or cylindrical co-ordinates 
can be selected. Further options allow the user to specify power or directive 
gain, and whether major and minor or vertical and horizontal axes gain must be 
computed. If the {\bf Show} button is clicked the graph is automatically 
zoomed out in such a way that the entire radiation pattern falls inside the Graph Window.
If a cylindrical co-ordinate system is used, the user must specify the ``Rho'' value. (The code will not accept a zero value in this case.) For spherical co-ordinates the ``Radius to fieldpoint'' value can be left zero. This would result in the $e^{jkr}/r$ term being suppressed in the {\em NEC\/} calculations. The observation points will be displayed at a default radius in the Graph Window. If a value of $r$ is specified for spherical co-ordinates, the user must ensure that the observation points do lie in the far-field.

\subsubsection{Coupling}
In the coupling window the user selects the element and segment numbers of two 
segments between which the coupling must be calculated. These are shown 
automatically. {\em NEC2\/} users must note that it is required to explicitly 
define voltage sources on these two elements before the coupling can be 
calculated.

\subsubsection{Execute}
The execute card allows a {\em single option parameter} enabling the automatic calculation of certain (pre-defined) radiation patterns. As the user changes these options, the corresponding observation points are displayed in the Graph Window.

\subsubsection{End, Next}
This adds the terminating card to the list; indicating respectively the end of 
the {\em NEC\/} run and the start of a new geometry.

\subsubsection{New item, Edit item}
Choosing {\bf Edit item} allows manual editing of the selected card. This can 
be used to fine-tune options not catered for or making simple changes. \\
Choosing {\bf New item} also calls the editor, but starts with a blank line. 
This enables the addition of Control Cards not automated in WireGrid. Cards added in this way are not ``checked'' in any way by WireGrid. 

\subsubsection{Delete, Copy}
These two buttons allow multiple cards to be copied or deleted. (Multiple 
cards can be selected by pressing $<$Shift$>$ for a continuous block, or 
$<$Ctrl$>$ for a discontinuous block, while selecting rows with the mouse.) If 
a discontinuous block is copied the new cards will be added in a 
continuous block below the last element in the selection.

\subsubsection{Read}
\label{sec:Read}
Using this function the user can read in control cards from other {\em 
WireGrid for Windows\/} models or existing {NEC\/} files. These cards are 
added to the bottom of the list and are read in without any changes. The cards 
that will be recognised and added to the list are:
\verb+CM+, \verb+CE+, \verb+GE+, \verb+GR+, \verb+GS+, \verb+GX+, \verb+CP+, 
\verb+EN+, \verb+EX+, \verb+FR+, \verb+GN+, \verb+LD+, \verb+LE+, \verb+LH+, 
\verb+NE+, \verb+NH+, \verb+NT+, \verb+NX+, \verb+PQ+, \verb+PS+, \verb+PT+, 
\verb+RP+, \verb+TL+ and \verb+XQ+.

\subsubsection{Move item up/down list}
The order of the control cards can be changed by clicking on the up and down 
arrow towards the bottom of the form (not those at the very bottom). This 
action is to be distinguished from using the up and down keys on the keyboard 
which merely moves the cursor up and down in the list --- without changing the 
order of the elements.

\subsubsection{Show action}
Setting the list cursor on a particular card (using either the mouse or the 
arrow keys), and clicking on the {\bf Show action} button will, if that card 
is implemented, visualise the command of that particular card. (The cards 
recognised by {\bf Read} --- see Section~\ref{sec:Read} --- are all implemented, but with varying completeness.) The type of card and some information regarding the card are given in the ``Comment line'' at the top of the window. If applicable, a graphical aid 
will be given in the Graph Window. This includes highlighting the segments 
affected by voltage sources, transmission lines, two-port networks and 
coupling cards; plotting the field points for radiation pattern (including 
those requested by the \verb+XQ+ card) and near-field calculations (including the line 
cards). The position and direction of current sources are also displayed. Cards loaded from {\em NEC} using commas as spacers should, in  most cases, be equally well interpreted by the {\bf Show action} button. If commas are used, zeros can be left blank, but not in the first integer position.

\subsubsection{Move graph in main window}
These four buttons allow the user to scroll the Graph Window from within the 
``Control Card editor'' if the current display of the model is larger than the Graph Window.

\subsection{Double click on item}
Double clicking on an item in the {\em Command list} allows the user to 
edit that card using the dedicated window rather than the string editor. The Control Cards 
which can be edited in this way are limited to \verb+CP+, \verb+EX+, \verb+FR+, \verb+LE+, \verb+LH+, \verb+NE+, \verb+NH+, \verb+NT+, \verb+RP+, \verb+TL+ and \verb+XQ+.


\subsection{Verify menu}
\label{sec:VerifyMenu}
\subsubsection{Number of segments}
This calculates the total number of segments in the discretised structure, 
allowing the user to determine whether the size of the model is still within the 
limits of {\em NEC}. (No meshing segments of un-discretised elements are counted.)

\subsubsection{Undiscretised structures}
This function presents a warning to the user if major elements exist which are not discretised. (This will happen if a major element(s) is large compared to the ``maximum segment length'', resulting in a meshing requirement of more than 50 lines in either direction.) If only one or two major elements cause problems, they can be divided into smaller major elements. If most of the elements are too large for discretisation, the ``maximum segment length'' should be adjusted accordingly.

\subsubsection{Underdiscretised sides}
This function checks all sides of each major element in the model to determine if any side  is longer than 255 times the specified ``maximum segment length''. (Segments on such sides will be longer than the required criterion which may cause problems in the analysis.)

\subsubsection{Duplicate Elements}
If a model contains duplicate elements it will not be apparent from the 
graphical display, but it may significantly corrupt the accuracy of the {\em 
NEC\/} analysis. This function checks for duplicate elements and highlights 
their second and higher occurrences. These elements should be deleted or 
changed.

\subsubsection{Non Touching Nodes}
Selecting this function opens a window in which the user can enter a minimum 
separation between nodes. On clicking {\bf Find} all unconnected nodes closer 
than the specified distance apart, will be listed. The list shows the element and {\em local} node numbers of each pair of nodes violating the specified criterion. Clicking on 
any position in the list will highlight that element and node in the Graph Window. The exact co-ordinates of the node are shown in the ``Co-ordinate boxes'' in the Information Bar. This enables the user to determine the exact difference between all non-connecting nodes. The appropriate co-ordinate corrections to the non-connecting nodes must be performed by the user (using the ``Edit Major Element'' feature).

\subsection{View menu}
\label{sec:ViewMenuSection}
\subsubsection{View Options}
This is a sub-menu allowing the user to determine the appearance of the model 
in the Graph Window. The components in the sub-menu are also available as buttons on 
the ``Graph Tool Bar.'' All of these are toggle type functions --- if selected 
they will appear checked in the menu and depressed in the ``Graph Tool Bar.''

{\bf NOTE:} Some of these functions can make the redrawing of models extremely slow and it 
is recommended that these options are removed if large models are to be 
rotated a number of times. 

\begin{itemize}
\item {\bf Show Nodes} shows all the nodes (including segment endpoints) on the main sides of major elements. 
\item When {\bf Show Discretisation} is selected element sides are shown in blue, the primary lines in purple and the secondary lines in green. (The distinction between these 
lines was discussed in Section~\ref{sec:StructureSection}.) 
\item When any of {\bf View From X}, {\bf View From Y} or {\bf View From Z} is 
selected the co-ordinates of the current cursor position (mouse cursor position in the Graph Window) will be shown (in black) inside the ``Co-ordinate boxes'' on the Information Bar --- provided no node is selected. The cursor is taken to be on the plane of the projection and one of the three co-ordinates will always be zero. This is important when viewing models using perspective where the projection on this plane is also dependent on the co-ordinate normal to the screen.

If any of the above three {\bf~``View~From~...''} buttons is unselected the viewer goes back to its original viewing angle. However, if one of the position boxes ($\theta$, $\phi$ or $r$ viewpoint boxes) is clicked while any one of the {\bf ``View From...''}  buttons is enabled, the viewpoint is set to the view angle associated with the enabled {\bf ``View From ...''} button. Also, the {\bf ``View From ...''} button is reset and the co-ordinate showing is switched off. 
\end{itemize}

\subsubsection{View Single Element}
This function selects a single element to be viewed from broadside allowing 
the user to check the discretisation and the effect of finite wire radii. 
Again the element sides are shown in blue, the primary lines in purple and the 
secondary lines in green.

\subsubsection{Zoom In, Zoom Out, Zoom Full}
By default the bitmap graph of the model is scaled to ensure that the entire model will fit inside the Graph Window, independent of the view direction. By using {\bf Zoom In} and {\bf Zoom Out} the size of the current graph can be increased or decreased. Note that the 
complete bitmap is re-sized --- the rest of the graph can be seen by clicking 
on the scroll bars. This implies that too much zooming can cause the graph to 
become extremely large requiring a very large memory capacity. {\bf Zoom Out} 
tries to keep the centre of the Graph Window in the centre of the entire graph. Once the graph is of the same size as the Graph Window it will not be decreased further, but the scale will be increased such that a larger part of the model will appear inside the graph. {\bf Zoom Full} resets the default graph scaling condition as well as the default view radius.

\subsubsection{Highlight Elements, Unhighlight Elements}
If the user chooses the {\bf Highlight Elements} function while elements are 
highlighted, the complete list of highlighted elements is presented. The user can  
modify the list or specify a new list (using the same format as discussed in Section~\ref{sec:CopyMajorElement} for the {\bf Copy Major Element(s)} function). 
{\bf Unhighlight Elements} clears the complete list of highlighted elements. It also clears the selected node.

\subsubsection{Set Axis Length}
This option allows the user to determine the length of the axis shown on the 
graph window. It will automatically select the {\bf Show Axis} option. This is 
of particular use in trying to convey a feel for the scale of the model.

\subsubsection{Change View Point}
This procedure merely sets the focus to the ``View Position'' boxes ensuring that 
the user can modify them by typing values or using the arrow keys. (It will 
probably only apply to users trying to use the code without a mouse.)


\subsection{Options menu}
\subsubsection{Wire Removal}
This sub-menu provides an alternative method to specify regions where wires 
must be removed for symmetry purposes (see Section~\ref{sec:SymmetryBar}). 
Again, this will probably only apply to users trying to use the code without a mouse.

\subsubsection{Set Wire Radii}
This procedure sets the focus to the ``Radius Box'' providing users without a 
mouse access to it (see Section~\ref{sec:RadiusBox}).


\subsection{Help menu}
At present, the Help menu only contains the {\bf About} item supplying the user with a WireGrid information screen.


\end{document}

